package zhr.chapter9;

import javax.swing.*;
import java.awt.*;

public class FlowLayoutFrame extends JFrame {
    private JButton button1;
    private JButton button2;
    private JButton button3;
    private JButton button4;
    private JButton button5;
    public FlowLayoutFrame(){
        button1 = new JButton("Button1");
        button2 = new JButton("Button2");
        button3 = new JButton("Button3");
        button4 = new JButton("Button4");
        button5 = new JButton("Button5");

        this.setLayout(new FlowLayout(FlowLayout.CENTER,50,20));
        this.add(button1);
        this.add(button2);
        this.add(button3);
        this.add(button4);
        this.add(button5);

        this.setTitle("FlowLayout流式布局");
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setSize(600,400);
        this.setLocation(100,50);
        this.setVisible(true);
    }
}
